package common.data.sysmanager {
	import common.model.WqCompanyInfo;
	import common.model.WqDepInfo;
	import common.model.WqStaffInfo;
	import common.model.WqUserInfo;
	
	import flash.utils.ByteArray;
	
	import mx.collections.ArrayCollection;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;

	public class SysManagerService extends RemoteObject{
		
		public function SysManagerService() {
			super("sysManagerService");
			this.showBusyCursor = true;
			
			//部门管理
			this.getOperation("saveDepInfo").addEventListener(ResultEvent.RESULT,saveDepInfoResult,false,0,true);
			this.getOperation("stopDepUse").addEventListener(ResultEvent.RESULT,stopDepUseResult,false,0,true);
		
			//员工管理
			this.getOperation("findStaffBy").addEventListener(ResultEvent.RESULT, findStaffByResult, false,0,true);
			this.getOperation("stopStaffUse").addEventListener(ResultEvent.RESULT, stopStaffUseResult, false,0,true);
			this.getOperation("activateStaffState").addEventListener(ResultEvent.RESULT, activateStaffStateResult, false,0,true);
			this.getOperation("cancelActivateStaffState").addEventListener(ResultEvent.RESULT, cancelActivateStaffStateResult, false,0,true);
			this.getOperation("findStaffRoleClient").addEventListener(ResultEvent.RESULT, findStaffRoleClientResult, false,0,true);
			this.getOperation("dealImportStaff").addEventListener(ResultEvent.RESULT, dealImportStaffResult, false,0,true);
			this.getOperation("dealImportStaff").addEventListener(FaultEvent.FAULT, dealImportStaffFaultResult, false,0,true);
			this.getOperation("saveStaffRoleClient").addEventListener(ResultEvent.RESULT, saveStaffRoleClientResult, false,0,true);
			this.getOperation("saveStaff").addEventListener(ResultEvent.RESULT, saveStaffResult, false,0,true);
			
			//公司管理
			this.getOperation("findMapRegoinBy").addEventListener(ResultEvent.RESULT, findMapRegoinByResult, false,0,true);
			this.getOperation("saveCompnayInfo").addEventListener(ResultEvent.RESULT, saveCompnayInfoResult, false,0,true);
			
			//用户管理
			this.getOperation("findUserById").addEventListener(ResultEvent.RESULT, findUserByIdResult, false,0,true);
			this.getOperation("delUser").addEventListener(ResultEvent.RESULT, delUserResult, false,0,true);
			this.getOperation("findDepBy").addEventListener(ResultEvent.RESULT, findDepByResult, false,0,true);
			this.getOperation("userMenuList").addEventListener(ResultEvent.RESULT, userMenuListResult, false,0,true);
			this.getOperation("saveUserMenu").addEventListener(ResultEvent.RESULT, saveUserMenuResult, false,0,true);
			this.getOperation("saveUserDep").addEventListener(ResultEvent.RESULT, saveUserDepResult, false,0,true);
			this.getOperation("addOrUpdateUser").addEventListener(ResultEvent.RESULT, addOrUpdateUserResult, false,0,true);
			
			
			//日志管理
			this.getOperation("findLogType").addEventListener(ResultEvent.RESULT, findLogTypeResult, false,0,true);
			this.getOperation("findLogBy").addEventListener(ResultEvent.RESULT, findLogByResult, false,0,true);
			this.getOperation("delLogBy").addEventListener(ResultEvent.RESULT, delLogByResult, false,0,true);
			
		}
		
		//部门管理
		public var saveDepInfoCallBack:Function;
		public var stopDepUseCallBack:Function;
		
		public function saveDepInfo(model:WqDepInfo):void{
			this.getOperation("saveDepInfo").send(model);
		}
		public function stopDepUse(model:Object):void{
			this.getOperation("stopDepUse").send(model);
		}
		private function saveDepInfoResult(e:ResultEvent):void{
			saveDepInfoCallBack.call(this,e);
		}
		private function stopDepUseResult(e:ResultEvent):void{
			stopDepUseCallBack.call(this,e);
		}
		
		//员工管理
		public var findStaffByCallBack:Function;
		public var stopStaffUseCallBack:Function;
		public var activateStaffStateCallBack:Function;
		public var cancelActivateStaffStateCallBack:Function;
		public var findStaffRoleClientCallBack:Function;
		public var dealImportStaffCallBack:Function;
		public var dealImportStaffFaultCallBack:Function;
		public var saveStaffRoleClientCallBack:Function;
		public var saveStaffCallBack:Function;
		
		public function findStaffBy(array:Array):void{
			this.getOperation("findStaffBy").send(array);
		}
		public function stopStaffUse(array:ArrayCollection):void{
			this.getOperation("stopStaffUse").send(array);
		}
		public function activateStaffState(array:ArrayCollection,fixModel:String):void{
			this.getOperation("activateStaffState").send(array,fixModel);
		}
		public function cancelActivateStaffState(array:ArrayCollection):void{
			this.getOperation("cancelActivateStaffState").send(array);
		}
		public function findStaffRoleClient(staff:WqStaffInfo):void{
			this.getOperation("findStaffRoleClient").send(staff);
		}
		public function dealImportStaff(data:ByteArray,dep:WqDepInfo,userName:String):void{
			this.getOperation("dealImportStaff").send(data,dep,userName);
		}
		public function saveStaffRoleClient(alignStaffs:Array,clientIdList:ArrayCollection,type:String):void{
			this.getOperation("saveStaffRoleClient").send(alignStaffs,clientIdList,type);
		}
		public function saveStaff(staff:WqStaffInfo):void{
			this.getOperation("saveStaff").send(staff);
		}
		
		private function findStaffByResult(e:ResultEvent):void{
			findStaffByCallBack.call(this,e);
		}
		private function stopStaffUseResult(e:ResultEvent):void{
			stopStaffUseCallBack.call(this,e);
		}
		private function activateStaffStateResult(e:ResultEvent):void{
			activateStaffStateCallBack.call(this,e);
		}
		private function cancelActivateStaffStateResult(e:ResultEvent):void{
			cancelActivateStaffStateCallBack.call(this,e);
		}
		private function findStaffRoleClientResult(e:ResultEvent):void{
			findStaffRoleClientCallBack.call(this,e);
		}
		private function dealImportStaffResult(e:ResultEvent):void{
			dealImportStaffCallBack.call(this,e);
		}
		private function dealImportStaffFaultResult(e:ResultEvent):void{
			dealImportStaffFaultCallBack.call(this,e);
		}
		private function saveStaffRoleClientResult(e:ResultEvent):void{
			saveStaffRoleClientCallBack.call(this,e);
		}
		private function saveStaffResult(e:ResultEvent):void{
			saveStaffCallBack.call(this,e);
		}
		
		//公司管理
		public var findMapRegoinByCallBack:Function;
		public var saveCompnayInfoCallBack:Function;
		
		public function findMapRegoinBy(array:Array):void{
			this.getOperation("findMapRegoinBy").send(array);
		}
		public function saveCompnayInfo(com:WqCompanyInfo,newRegionList:ArrayCollection,oldMapRegionList:ArrayCollection):void{
			this.getOperation("saveCompnayInfo").send(com,newRegionList,oldMapRegionList);
		}
		private function findMapRegoinByResult(e:ResultEvent):void{
			findMapRegoinByCallBack.call(this,e);
		}
		private function saveCompnayInfoResult(e:ResultEvent):void{
			saveCompnayInfoCallBack.call(this,e);
		}
		
		//用户管理
		public var findUserByIdCallBack:Function;
		public var delUserCallBack:Function;
		public var findDepByCallBack:Function;
		public var userMenuListCallBack:Function;
		public var saveUserMenuCallBack:Function;
		public var saveUserDepCallBack:Function;
		public var addOrUpdateUserCallBack:Function;
		
		public function findUserById(userId:String,userName:String,cnName:String):void{
			this.getOperation("findUserById").send(userId,userName,cnName);
		}
		public function delUser(user:WqUserInfo):void{
			this.getOperation("delUser").send(user);
		}
		public function findDepBy(user:WqUserInfo):void{
			this.getOperation("findDepBy").send(user);
		}
		public function userMenuList(userId:String):void{
			this.getOperation("userMenuList").send(userId);
		}
		public function saveUserMenu(menuList:Array,user:WqUserInfo):void{
			this.getOperation("saveUserMenu").send(menuList,user);
		}
		public function saveUserDep(depList:Array,user:WqUserInfo):void{
			this.getOperation("saveUserDep").send(depList,user);
		}
		public function addOrUpdateUser(user:WqUserInfo):void{
			this.getOperation("addOrUpdateUser").send(user);
		}
		private function findUserByIdResult(e:ResultEvent):void{
			findUserByIdCallBack.call(this,e);
		}
		private function delUserResult(e:ResultEvent):void{
			delUserCallBack.call(this,e);
		}
		private function findDepByResult(e:ResultEvent):void{
			findDepByCallBack.call(this,e);
		}
		private function userMenuListResult(e:ResultEvent):void{
			userMenuListCallBack.call(this,e);
		}
		private function saveUserMenuResult(e:ResultEvent):void{
			saveUserMenuCallBack.call(this,e);
		}
		private function saveUserDepResult(e:ResultEvent):void{
			saveUserDepCallBack.call(this,e);
		}
		private function addOrUpdateUserResult(e:ResultEvent):void{
			addOrUpdateUserCallBack.call(this,e);
		}
		
		//日志管理
		public var findLogTypeCallBack:Function;
		public var findLogByCallBack:Function;
		public var delLogByCallBack:Function;
		
		public function findLogType():void{
			this.getOperation("findLogType").send();
		}
		public function findLogBy(logTypeId:String,startTime:String,endTime:String,userName:String,companyId:String):void{
			this.getOperation("findLogBy").send(logTypeId,startTime,endTime,userName,companyId);
		}
		public function delLogBy(logTypeId:String,startTime:String,endTime:String,userName:String,companyId:String):void{
			this.getOperation("delLogBy").send(logTypeId,startTime,endTime,userName,companyId);
		}
		private function findLogTypeResult(e:ResultEvent):void{
			findLogTypeCallBack.call(this,e);
		}
		private function findLogByResult(e:ResultEvent):void{
			findLogByCallBack.call(this,e);
		}
		private function delLogByResult(e:ResultEvent):void{
			delLogByCallBack.call(this,e);
		}
		
	}
}